package d.n.d.service;

import java.util.Date;
import java.util.List;
import org.springframework.ui.Model;
import d.n.d.domain.Account;
import d.n.d.domain.RespJSON;
import d.n.d.domain.Transaction;
import d.n.d.domain.User;

/**
 * 
 * @author D.N.D
 *
 */
public interface TransactionService {
	
	/**
	 * <br> Author: DucLV </br>
	 * <br> Confirm Information has been input from GUI for ADDING FUNDS. </br>
	 * @param accountNumber Account
	 * @param moneyTransaction Money Add
	 * @return RespJSON Object
	 */
	public RespJSON confirmInfoMoneyAdd(String accountNumber,
			String pstrMoneyTransaction);
	
	/**
	 * <br> Author: DucLV </br>
	 * <br> Execute request for submitting add fund into database. </br>
	 * @param accountNumber Account
	 * @param moneyTransaction Money Add
	 * @param userSupport
	 * @return RespJSON Object
	 */
	public RespJSON executeMoneyAdd(String accountNumber,
			double moneyTransaction, User userSupport);
	
	/**
	 * @author DucLV </br>
	 * Confirm information after select APPROVE function.
	 * 
	 * @param transactionId
	 * 
	 * @return RespJSON Object
	 */
	public RespJSON confirmInfoApproveTransaction(String transactionId);

	/**
	 * @author DucLV </br>
	 * Execute APPROVE into Database.
	 * 
	 * @param transactionId 
	 * @param transactionComment
	 * @param userAdmin
	 * 
	 * @return RespJSON Object
	 */
	public RespJSON executeApproveTransaction(String transactionId, String transactionComment, User userAdmin);
	/**
	 * 
	 * @param accountId
	 * @return List<Transaction>
	 */
	public List<Transaction> getTransactionListByAccountId(String accountId);

	/**
	 * 
	 * @param from
	 * @param to
	 * @param accountId
	 * @return List<Transaction>
	 */
	public List<Transaction> getTransactionListByCustomer(Date from, Date to,
			String accountId);

	/**
	 * <br> Author: DucDS </br>
	 * @return List<Transaction>
	 */
	public List<Transaction> getTransactionListPending();

	/**
	 * 
	 * @param transactionId
	 * @return Transaction
	 */
	public Transaction findTransactionById(int transactionId);

	/**
	 * 
	 * @param transactionId
	 * @return Transaction
	 */
	public Transaction findTransactionByStringId(String transactionId);


	/**
	 * 
	 * @param transaction
	 * @return boolean
	 */
	public boolean updateTransaction(Transaction transaction);

	/**
	 * 
	 * @param account
	 * @param transaction
	 * @return boolean
	 */
	public boolean update(Account account, Transaction transaction);

	/**
	 * 
	 * @param sendAccount
	 * @param receiveAccount
	 * @param transaction
	 * @return boolean
	 */
	public boolean update(Account sendAccount, Account receiveAccount,
			Transaction transaction);

	/**
	 * 
	 * @param transactionId
	 * @return String
	 */
	public String verifyTransaction(String transactionId);

	/**
	 * 
	 * @param transactionId
	 * @param userAmin
	 * @param comment
	 * @return boolean
	 */
	public boolean approve(String transactionId, User userAmin, String comment);

	/**
	 * 
	 * @param transactionId
	 * @param userAmin
	 * @param comment
	 * @return boolean
	 */
	public boolean reject(String transactionId, User userAmin, String comment);

	/**
	 * 
	 * @param doubleAmount
	 * @param tempAccount
	 * @param userSupport
	 * @return boolean
	 */
	public boolean createAddFundsTransaction(double doubleAmount,
			Account sendAccount, User userSupport);

	/**
	 * 
	 * @param doubleAmount
	 * @param tempAccount
	 * @param userSupport
	 * @return boolean
	 */
	public boolean createWithdrawTransaction(double doubleAmount,
			Account tempAccount, User userSupport);

	/**
	 * <br> Author: DucDS </br>
	 * @param amountTransfer
	 * @param senderAccountNumber
	 * @param receiverAccountNumber
	 * @param userSupport
	 * @return boolean True if success and false if fail
	 */
	public boolean createTransferTransaction(String amountTransfer,
			String senderAccountNumber, String receiverAccountNumber,
			User userSupport);



//	public String verifyAddFund(String moneyTransaction);
	
	public boolean verifyWithdraw(String moneyTransactionWithdraw, double balance);

	
	/**
	 * <br> Author: DucDS </br>
	 * <br> Confirm Information has been input from GUI for Money Transfer. </br>
	 * @param pstrAccountNumber Account Sender
	 * @param pstrMoneyTransfer Money transfer
	 * @param pstrReceiverAccount Receiver account number.
	 * @return RespJSON Object
	 */
	public RespJSON confirmInfoMoneyTransfer(String pstrAccountNumber,
			String pstrMoneyTransfer, String pstrReceiverAccount);
	
	/**
	 * <br> Author: DucDS </br>
	 * <br> Confirm Information has been input from GUI for Money Transfer. </br>
	 * @param pstrAccountNumber Account Sender
	 * @param pstrMoneyTransfer Money transfer
	 * @param pstrReceiverAccount Receiver account number.
	 * @param pUser User Support
	 * @return RespJSON Object
	 */
	public RespJSON executeMoneyTransfer(String pstrAccountNumber,
			String pstrMoneyTransfer, String pstrReceiverAccount, User pUser);
	
	/**
	 * <br> Author: DucDS. </br>
	 * <br> Method check validate of Date input. </br>
	 * @param pstrDate
	 * @return
	 */
	public boolean isValidDate(String pstrFromDate, String pstrToDate);
	
	/**
	 * <br> Author: DucDS. </br>
	 * <br> Method search Transaction By Id Card. </br> 
	 * @param pModel Model
	 * @param pstrIdCard ID card number
	 * @return
	 */
	public String searchTransactionByIdCard(Model pModel, String pstrIdCard);
	
	/**
	 * <br> Author: DucDS. </br>
	 * <br> Method view Transaction By Account Number. </br> 
	 * @param pstrIdCardNumber
	 * @param pstrAccountNumber
	 * @return
	 */
	public String viewTransactionByAccountNumber(Model pModel,
			String pstrIdCardNumber, String pstrAccountNumber, Date fromDate,
			Date toDate, String pstrFromDate, String pstrToDate);
	
	
}
